﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using Oracle.DataAccess.Client;
using Wicresoft.UnifyShow.Business;
using Wicresoft.UnifyShow.BusinessImpl;

namespace UnifyShowTest
{
    class TestJoins
    {

        [Fact]
        public void TestPrepareSQL()
        {
            OracleDataAccess oda = new OracleDataAccess();
            QueryParameter[] attParam = new QueryParameter[] {
                    new QueryParameter(){ OracleDbColumnName="name", OracleDbColumnType=OracleDbType.NVarchar2, OracleDbColumnSize=20,OracleDbColumnValue="Name",QueryOperator=QueryOperatorType.like},
                    };
            OrderbyParameter[] ops = new OrderbyParameter[]{
                new OrderbyParameter(){orderByCol="Name",orderByType=OrderByType.ascending}
            };

            JoinCauses x = new JoinCauses();
            JoinCause c1 = new JoinCause();
            c1.Alia = "a";
            c1.TableName = "HelloTableName";
            c1.Type = JoinType.inner;
            c1.AddQueryParameter(new QueryParameter()
            {
                OracleDbColumnName = "name",
                OracleDbColumnType = OracleDbType.NVarchar2,
                OracleDbColumnSize = 20,
                OracleDbColumnValue = "Name",
                QueryOperator = QueryOperatorType.like,
                PredicateType = PredicateType.where
            });
            c1.AddOnQuery(new OnQueryParameter()
                {
                    AliaLeft = "a",
                    AliaRight = "z",
                    ColumnNameLeft = "aColumn",
                    ColumnNameRight = "zColumn"
                });
            x.Add(c1);

            ModelHelper<ExampleModel>.GetModel_By_QueryParams(attParam, ops, 9, 0, oda, x);

        }

        [Fact]
        public void TestOracle()
        {
            OracleDataAccess oda = new OracleDataAccess();
            OracleDataReader re = oda.ExecuteReader("select * from USER_TAB_COLUMNS where TABLE_NAME='USER'");
            re.Read();
            int i = 1;
        }

    }
}
